<template>
  <div class="tab">
    <router-link to="/index" class="item">
      <div class="icon icon1"></div>
      <p>首页</p>
    </router-link>
    <router-link to="/discounts"  class="item" >
      <div class="icon icon2"></div>
      <p>特惠</p>
    </router-link>
    <router-link to="/articles" class="item" >
      <div class="icon icon3"></div>
      <p>文章</p>
    </router-link>
    <router-link to="/authorDetail" class="item">
      <div class="icon icon4"></div>
      <p>我的</p>
    </router-link>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  }
};
</script>

<style lang="less" scoped>
.tab {
  height: 1rem;
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  background-color: #fff;
  z-index: 99;
  display: flex;
  border-top: 1px solid #dadada;
  padding-top: 0.1rem;
  box-sizing: border-box;
  .item {
    flex: 1;
    position: relative;
    .icon {
      position: absolute;
      width: 0.48rem;
      height: 0.48rem;
      display: block;
      left: 50%;
      transform: translateX(-50%);
      background-size: 0.48rem 0.48rem;
    }
    .icon1 {
      background-image: url("../../assets/images/icon/10.png");
    }
    .icon2 {
      background-image: url("../../assets/images/icon/6.png");
    }
    .icon3 {
      background-image: url("../../assets/images/icon/4.png");
    }
    .icon4 {
      background-image: url("../../assets/images/icon/8.png");
    }
    p {
      position: absolute;
      width: 100%;
      text-align: center;
      line-height: 0.4rem;
      font-size: 0.24rem;
      height: 0.4rem;
      bottom: 0.1rem;
      color: #666;
    }
  }
  .router-link-active {
    p {
      color: blue;
    }
    .icon1 {
      background-image: url("../../assets/images/icon/9.png");
    }
    .icon2 {
      background-image: url("../../assets/images/icon/5.png");
    }
    .icon3 {
      background-image: url("../../assets/images/icon/3.png");
    }
    .icon4 {
      background-image: url("../../assets/images/icon/7.png");
    }
  }
}
</style>
